//
//  SettingModelView.m
//  TYAlertControllerDemo
//
//  Created by tanyang on 15/10/26.
//  Copyright © 2015年 tanyang. All rights reserved.
//

#import "SettingModelView.h"
#import <IQKeyboardManager/IQKeyboardManager.h>
#import "UIView+TYAlertView.h"
@interface SettingModelView()
@end
@implementation SettingModelView

-(instancetype)initWithCoder:(NSCoder *)aDecoder
{
    if (self = [super initWithCoder:aDecoder]) {
//        self.manager = [AFHTTPSessionManager manager];
//        self.id = [UserDefaultsHelper readId];
    }
    return self;
}
- (IBAction)tf:(UITextField *)sender {
    self.inputTF.text = sender.text;
}
- (IBAction)senderBtn:(UIButton *)sender {
//http://www.qichangkeji.vip/qckjgzh/communication/send
    if (!self.changeMingZi) {
//        self.guId= [UserDefaultsHelper readGuId];
//
//        NSDictionary *dict = @{
//                               @"userId":self.id,
//                               @"guId":self.guId,
//                               @"sendId":self.id,
//                               @"receivedId":self.receivedId,
//                               @"content":self.inputTF.text
//                               };
//        [CustomeManager POSTWithURLString:@"http://www.qichangkeji.vip/qckjgzh/communication/send" parameters:dict success:^(NSDictionary *dict) {
//            [WSProgressHUD  showShimmeringString:@"发送成功"];
//            //发送成功通知刷新
//            //XLog(@"dict:%@",dict);
//            self.inputTF.text = @"";
//            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//                [WSProgressHUD dismiss];
//            });
//
//        } failure:^(NSError *error) {
//
//        }];

    }else {
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            [WSProgressHUD dismiss];
            [self hideView];
            [self hideInWindow];
            [self.inputTF resignFirstResponder];
            if (self.returnValueBlock) {
                self.returnValueBlock(self.inputTF.text);
            };
        });
        
    }
    
    
}

@end
